<template>
  <div>
    <top-bar></top-bar>
    <div id="container">
      <div id="content">
        <div id="bg">
          <img id="avatar" src="../../assets/img/Avatar.jpg" alt />
          <p style="font-size: 24px">{{userName}}</p>
          <p style="font-size: 12px;color: #f5dccb">一句话介绍一下自己吧，让别人更了解你</p>
        </div>
        <div id="tab">
          <button @click="toArchives" :class="$route.fullPath=='/setting/myArchives'?'btn active':'btn'">个人信息</button>
          <button @click="toDynamic" :class="$route.fullPath=='/setting/myDynamic'?'btn active':'btn'">我的动态</button>
          <button @click="toMyConcern" :class="$route.fullPath=='/setting/myConcern'?'btn active':'btn'">我的关注</button>
          <button @click="toMyCollection" :class="$route.fullPath=='/setting/myCollection'?'btn active':'btn'">我的收藏</button>
          <button @click="toMySetting" :class="$route.fullPath=='/setting/setting'?'btn active':'btn'">个人设置</button>

        </div>
      </div>
        <transition name="fade">
          <router-view></router-view>
        </transition>


    </div>
  </div>
</template>

<script>
import TopBar from "../../components/content/TopBar";
export default {
  name: "index",
  components: {
    TopBar,
  },
  data() {
    return {
      userName:localStorage.getItem('userName'),
    };
  },
  created() {
  },
  methods: {
    toArchives() {
      this.$router.push("/setting/myArchives")
    },
    toDynamic() {
      this.$router.push("/setting/myDynamic")
    },
    toMySetting() {
      this.$router.push("/setting/setting")
    },
    toMyConcern(){
      this.$router.push("/setting/myConcern")
    },
    toMyCollection(){
      this.$router.push("/setting/myCollection")
    }
  },
};
</script>

<style scoped>
.fade-enter-active {
  transition: all .2s ease;
  transition-delay: .2s;
}

.fade-leave-active {
  transition: all .2s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}

.fade-enter
  /* .slide-fade-leave-active for below version 2.1.8 */
{
  transform: translateY(30px);
  opacity: 0;
}
.fade-leave-to{
  transform: translateY(-30px);
  opacity: 0;
}
#container {
  width: 100%;
  /*height: 100vh;*/
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #ece0e0;
}
#content {
  box-shadow: 0 2px 4px #e0e0e0;
  margin-top: 100px;
  width: 70%;
  height: 460px;
  background-color: #fff;
}
#bg {
  overflow: hidden;
  width: 100%;
  height: 90%;
  background: url("../../assets/img/pen-4337521_1280.jpg") no-repeat center center;
  background-size: 150% 150%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: rgba(255, 255, 255, 0.8);
  animation: archive 6s linear forwards;
  transform-origin: center center;
}
@keyframes archive {
  0%{
    background-size:150% 150%;
  }
  100%{
    background-size: 100% 100%;
  }
}
#bg * {
  margin: 0;
}
#avatar {
  border-radius: 50%;
  height: 80px;
  border: gainsboro solid 2px;
}
#tab {
  width: 100%;
  height: 10%;
  background-color: #fff;
  /*border-bottom: 1px solid blue;*/
  display: flex;
  justify-content: center;
  box-shadow: 0 1px 2px rgb(232, 232, 232);
}
.btn {
  cursor: pointer;
  margin: 0 50px;
  outline: none;
  border: none;
  background-color: #fff;
}
.active {
  font-weight: 600;
  border-bottom: 2px solid orange;
}
</style>